package kr.hkit.powerjava.chapter10.submit;

import java.util.Random;

class Number {

	private Random rnd;
	private static int i;
	int[] num = new int[10];

	public Number() {
		rnd = new Random(); //이걸 꼭 해줘야 하나? 
	}

	public int getNum() {
		return rnd.nextInt(100) + 1;
	}

	public void getNum2() {
		for (i = 0; i < num.length; i++) {
			num[i] = getNum();
		} 
	}

	public void getDistri() {

		System.out.print("1 - 10: ");
		for (int i = 0; i < num.length; i++)
			if (num[i] > 0 && num[i] < 11) { 
				System.out.print("*");
			}
		System.out.println(" ");

		System.out.print("11 - 20: ");
		for (i = 0; i < num.length; i++)
			if (num[i] > 10 && num[i] < 21) {
				System.out.print("*");
			}
		System.out.println(" ");

		System.out.print("21 - 30: ");
		for (i = 0; i < num.length; i++)
			if (num[i] > 20 && num[i] < 31) { 
				System.out.print("*");
			}
		System.out.println(" ");

		System.out.print("31 - 40: ");
		for (i = 0; i < num.length; i++)
			if (num[i] > 30 && num[i] < 41) { 
				System.out.print("*");
			}
		System.out.println(" ");

		System.out.print("41 - 50: ");
		for (i = 0; i < num.length; i++)
			if (num[i] > 40 && num[i] < 51) {
				System.out.print("*");
			}
		System.out.println(" ");

		System.out.print("51 - 60: ");
		for (i = 0; i < num.length; i++) {
			if (num[i] > 50 && num[i] < 61) { 
				System.out.print("*");
			}
			System.out.println(" ");

			System.out.print("61 - 70: ");
			for (i = 0; i < num.length; i++)
				if (num[i] > 60 && num[i] < 71) {
					System.out.print("*");
				}
			System.out.println(" ");

			System.out.print("71 - 80: ");
			for (i = 0; i < num.length; i++)
				if (num[i] > 70 && num[i] < 81) {
					System.out.print("*");
				}
			System.out.println(" ");
			
			System.out.print("81 - 90: ");
			for (i = 0; i < num.length; i++)
				if (num[i] > 80 && num[i] < 91) { 
					System.out.print("*");
				}
			System.out.println(" ");

			System.out.print("91 - 100: ");
			for (i = 0; i < num.length; i++)
				if (num[i] > 90 && num[i] < 101) { 
					System.out.print("*");
				}
			System.out.println(" ");

		}
	}
}
